home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / moush101.zip / BGI.HPP next >
C/C++ Source or Header  |  1992-07-25  |  549b  |  41 lines

  1. // BGI.HPP
  2. //
  3. // Code to allow C++ encapsulation of graphics system
  4. //
  5. // Michael Chen 7/24/92
  6.  
  7. #ifndef __BGI_HPP
  8. #define __BGI_HPP
  9.  
  10. #include <graphics.h>
  11.  
  12. // Define BGI class
  13.  
  14. class BGI
  15. {
  16. public:
  17.   int driver;
  18.   int mode;
  19.   BGI(int d=DETECT,int m=DETECT);    // defined later
  20.   ~BGI(void);                // defined later
  21. };
  22.  
  23.  
  24. inline BGI::BGI(int d, int m)
  25. {
  26.   char *cp;
  27.  
  28.   driver = d;
  29.   mode = m;
  30.   cp = getenv("BGIDIR");
  31.   initgraph(&driver,&mode, (cp ? cp : "") );
  32. }
  33.  
  34. inline BGI::~BGI(void)
  35. {
  36.   closegraph();
  37. }
  38.  
  39.  
  40. #endif
  41.